﻿CREATE VIEW dbo.vx_ApplInfo
AS
SELECT     t_Loan.ID AS LoanID, v_Borrower_0.FirstName, v_Borrower_0.LastName, v_Borrower_0.DOBMonth, v_Borrower_0.DOBDay, v_Borrower_0.DOBYear, 
                      v_Borrower_0.SSN, v_Borrower_0.PhoneHome, t_Loan.StatusID, dbo.t_Dealer_SalesPersons.DealerID, t_Loan.DealerSalesPersonID, 
                      dbo.v_Menu.MenuPath, v_Borrower_0.DriverLicense, t_Loan.StatusID AS LoanStatusID
FROM         dbo.t_Dealer_SalesPersons INNER JOIN
                      dbo.t_Loan AS t_Loan INNER JOIN
                      dbo.t_CarInfo ON t_Loan.ID = dbo.t_CarInfo.LoanID INNER JOIN
                      dbo.v_Menu ON t_Loan.StatusID = dbo.v_Menu.MenuID INNER JOIN
                      dbo.Borrower(DEFAULT, 0) AS v_Borrower_0 ON t_Loan.ID = v_Borrower_0.LoanID ON 
                      dbo.t_Dealer_SalesPersons.ID = t_Loan.DealerSalesPersonID LEFT OUTER JOIN
                      dbo.t_Loan_Borrower AS v_Borrower_1 ON t_Loan.ID = v_Borrower_1.LoanID AND v_Borrower_1.Pos = 1

GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[29] 2[14] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1[50] 4[25] 3) )"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1[50] 2[25] 3) )"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4[30] 2[40] 3) )"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2[66] 3) )"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4[50] 3) )"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3) )"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[44] 4[30] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1[75] 4) )"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4[76] 2) )"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4) )"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2) )"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "v_Borrower_1"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 115
               Right = 204
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "t_Loan"
            Begin Extent = 
               Top = 165
               Left = 499
               Bottom = 501
               Right = 679
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "t_CarInfo"
            Begin Extent = 
               Top = 40
               Left = 906
               Bottom = 284
               Right = 1086
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "v_Menu"
            Begin Extent = 
               Top = 142
               Left = 77
               Bottom = 335
               Right = 239
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "v_Borrower_0"
            Begin Extent = 
               Top = 349
               Left = 92
               Bottom = 713
               Right = 258
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "t_Dealer_SalesPersons"
            Begin Extent = 
               Top = 187
               Left = 770
               Bottom = 296
               Right = 921
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 25
         Width = 284
         Width = 1500', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'vx_ApplInfo';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = N'Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 2235
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 3540
         Alias = 2040
         Table = 1515
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'vx_ApplInfo';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'vx_ApplInfo';

